package com.trace.learn;

import org.slf4j.MDC;

/**
 * 父子线程MDC
 * @author chenxin
 * @time 2017-03-16-10:01
 */
public class ThreadMDCTest {
    public static void main(String[] args) {
        MDC.put("thread-name", "main");

        Thread son = new Thread(new Runnable() {
            public void run() {
                System.out.println(MDC.get("thread-name") + " son run");
            }
        });
        son.setName("son-thread");
        son.start();
        System.out.println(MDC.get("thread-name") + " main run");

        System.out.println(MDC.getMDCAdapter().getClass());
    }
}
